<?php
defined ( 'BASEPATH' ) or exit ( 'No direct script access allowed' );
/**
 * Title           decryption
 *
 * @package        LMJ-futureid
 * Location        application/frontend/helpers/util/mobile/
 * @author:        Azeem <<azeem.jainulabdeen@cyberlmj.com>>
 * @copyright      Cyber L-M-J
 * @Description    decripting the pass word :decrypting password which is encoded(base 64)(This is we can use for mobile device to PHP)
 * @created        14/12/2011
 **/

/**
 * desc:decripting the pass word :decrypting password which is encoded(base 64)
 * @param mixed encoded $pass
 * @param mixed $key
 * @return type 
 * @access public
 * 
 */


   function decrypt_password($pass,$key)
   {
        //echo urlencode($pass2);     
        
        $base64encoded_ciphertext = $pass;
        $res_non = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, base64_decode($base64encoded_ciphertext), 'ecb');
        $decrypted = $res_non;
        $dec_s2 = strlen($decrypted);
        
        $padding = ord($decrypted[$dec_s2-1]);
        $decrypted = substr($decrypted, 0, -$padding);
       
      return  $decrypted;
   }

